package studyguide.ch09.graphics;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

public class GraphicsCanvasH extends Canvas {

	protected void paint(Graphics g) {
		// Clear screen
		g.setColor(255, 255, 255);
		g.fillRect(0, 0, getWidth(), getHeight());
		
		// Vertical distance between objects:
		int x = getWidth() / 2;
		int yStep = getHeight() / 3;
		g.setColor(0); // Black

		g.translate(0, yStep);
		g.drawString("First", x, 0, Graphics.HCENTER|Graphics.TOP);
		
		g.translate(0, yStep);
		g.drawString("Second", x, 0, Graphics.HCENTER|Graphics.TOP);
		
		g.translate(0, -g.getTranslateY());
		g.drawString("Third", x, 0, Graphics.HCENTER|Graphics.TOP);
		
	}

}
